package pagecontroller;

import controller.UserController;
import modelo.TipoGrupo;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author aluno
 */
public class PageManager {

    private String pageActive = "./pages/principal.xhtml";
    private String menuActive = "./pages/menuArquivo.xhtml";

    public String getPageActive() {
        return pageActive;
    }

    private void setPageActive(String pageActive) {
        this.pageActive = pageActive;
    }

    public String getMenuActive() {
        return menuActive;
    }

    public void setMenuActive(String menuActive) {
        this.menuActive = menuActive;
    }



    public PageManager() {
    }

    public String setMenuPrincipal() {
         this.setPageActive("./pages/principal.xhtml");
        this.setMenuActive("./pages/menuPrincipal.xhtml");
        return "refreshPage";
    }

    public String setMenuArquivo() {
        this.setMenuActive("./pages/menuArquivo.xhtml");
        return "refreshPage";
    }
     public String setMenuDiploma() {
        this.setMenuActive("./pages/menuDiploma.xhtml");
        return "refreshPage";
    }
      public String setMenuConfiguracoes() {
        this.setMenuActive("./pages/menuConfiguracoes.xhtml");
        return "refreshPage";
    }
       public String setMenuUsuario() {
        this.setMenuActive("./pages/menuUsuario.xhtml");
        return "refreshPage";
    }
    
    public String setPagePrincipal() {
        this.setPageActive("./pages/principal.xhtml");
        return "refreshPage";
    }


    public String setPageInserirArquivo() {
        this.setPageActive("./pages/arquivoCad.xhtml");
        //return "refreshPage";
        return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageConsultarAluno() {
        this.setPageActive("./pages/arquivoSearch.xhtml");
        return "refreshPage";
    }
    
    public String setPageConsultarAlunoCurso() {
        this.setPageActive("./pages/arquivoSearchCurso.xhtml");
        return "refreshPage";
    }

    public String setPageConsultarDiploma() {
        this.setPageActive("./pages/diplomaSearch.xhtml");
        return "refreshPage";
    }

    public String setPageConsultarDiplomaSituacao() {
        this.setPageActive("./pages/diplomaSearchSituacao.xhtml");
        return "refreshPage";
    }

    public String setPageConsultarCaixa() {
        this.setPageActive("./pages/caixaSearch.xhtml");
        return "refreshPage";
    }

    public String setPageCursos() {
        this.setPageActive("./pages/cursos.xhtml");
        return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageSobre() {
        this.setPageActive("./pages/sobre.xhtml");
        return "refreshPage";
    }

    public String setPageRelatArquivo() {
        this.setPageActive("./pages/arquivoRelat.xhtml");
        return "refreshPage";
    }

    public String setPageRelatDiploma() {
        this.setPageActive("./pages/diplomaRelat.xhtml");
        return "refreshPage";
    }

    public String setPageResultSearchArquivo() {
        this.setPageActive("./pages/arquivoSearchResult.xhtml");
        return "refreshPage";
    }
    public String setPageResultSearchDiploma() {
        this.setPageActive("./pages/diplomaSearchResult.xhtml");
        return "refreshPage";
    }

    public String setPageInserirDiploma() {
        this.setPageActive("./pages/diplomaCad.xhtml");
        return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageRelatSituacaoDoDiploma() {
        this.setPageActive("./pages/diplomaSituacaoDoDiplomaRelat.xhtml");
        return "refreshPage";
    }
    public String setPageCadSituacaoDoDiploma() {
        this.setPageActive("./pages/diplomaSituacaoDoDiplomaCad.xhtml");
        return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageMeusDados() {
        this.setPageActive("./pages/meusDados.xhtml");
        return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageLogin() {
        this.setPageActive("./pages/login.xhtml");
        return "refreshPage";
    }

    public String setPageCadUsuario() {
        this.setPageActive("./pages/usuarioCad.xhtml");
       return verificaPermissao(TipoGrupo.SECRETARIA);
    }

    public String setPageRelatUsuario() {
        this.setPageActive("./pages/usuarioRelat.xhtml");
        return "refreshPage";
    }
    
    public String setPageListUsuario() {
        this.setPageActive("./pages/usuariosList.xhtml");
        return "refreshPage";
    }

    public String verificaPermissao(TipoGrupo grupo){
        UserController userController = (UserController) JsfUtil.getObjectFromSession("UserController");
        if(userController.getUsuarioLogado() == null){
            setPageLogin();
        }
        return "refreshPage";
    }




}
